<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<LINK rel="Bookmark" href="/favicon.ico">
<LINK rel="Shortcut Icon" href="/favicon.ico" />
<!--[if lt IE 9]>
<script type="text/javascript" src="${ctxPath}/r/lib/html5.js"></script>
<script type="text/javascript" src="${ctxPath}/r/lib/respond.min.js"></script>
<script type="text/javascript" src="${ctxPath}/r/lib/PIE_IE678.js"></script>
<![endif]-->
<link rel="stylesheet" type="text/css"
	href="${ctxPath}/r/system/h-ui/css/H-ui.min.css" />
<link rel="stylesheet" type="text/css"
	href="${ctxPath}/r/system/h-ui/css/H-ui.admin.css" />
<link rel="stylesheet" type="text/css"
	href="${ctxPath}/r/lib/Hui-iconfont/1.0.7/iconfont.css" />
<link rel="stylesheet" type="text/css"
	href="${ctxPath}/r/lib/icheck/icheck.css" />
<link rel="stylesheet" type="text/css"
	href="${ctxPath}/r/system/h-ui/skin/default/skin.css" id="skin" />
<link rel="stylesheet" type="text/css"
	href="${ctxPath}/r/system/css/style.css" />
<!--[if IE 6]>
<script type="text/javascript" src="http://lib.h-ui.net/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<title>添加栏目- ${powered!}</title>
</head>

<body>
	<article class="page-container">
		<form action="${ctxPath}/system/category/save" class="form form-horizontal" id="form-modelfiled-add">
			<input type="hidden" name="category.site_id" value="${siteId!}">
			<input type="hidden" name="category.category_id" value="${category.categoryId!}">
			${token!}
			<div class="row cl">
				<label class="form-label col-xs-4 col-sm-3"><span
					class="c-red">*</span>栏目名称：</label>
				<div class="formControls col-xs-8 col-sm-9">
					<input type="text"  class="input-text" name="category.category_name"
						value="${category.category_name!}" placeholder="栏目名称">
				</div>
			</div>
			<div class="row cl">
				<label class="form-label col-xs-4 col-sm-3"><span
					class="c-red">*</span>英文名称：</label>
				<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" name="category.shortname"
						value="${category.shortname!}" placeholder="缩写名称">
				</div>
			</div>
			<div class="row cl">
				<label class="form-label col-xs-4 col-sm-3"><span
					class="c-red">*</span>栏目分类：</label>
				<div class="formControls col-xs-8 col-sm-9">
				 <select id="filedClass" class="input-text" name="category.parent_id">
				   <option  value="0">顶级分类</option> 
				   @for(cat in cats){
				     @if(!isEmpty(category.categoryId)&&category.parentId==cat.categoryId){
				   <option value="${cat.categoryId!}" selected="selected">${cat.categoryName!}</option>
			         @}else{
			       <option value="${cat.categoryId!}">${cat.categoryName!}</option>
			        @}
				   @}
				 </select>
				</div>
			</div>
			<div class="row cl">
				<label class="form-label col-xs-4 col-sm-3"><span
					class="c-red">*</span>内容模型：</label>
				<div class="formControls col-xs-8 col-sm-9">
				 <select id="filedClass" class="input-text" name="category.model_id">
				   <option value="" >请选择</option> 
				   @for(model in models){
				   @if(!isEmpty(category.modelId)&&category.modelId==model.modelId){
				   <option value="${model.modelId!}" selected="selected">${model.modelName!}</option>
				   @}else{
				   <option value="${model.modelId!}">${model.modelName!}</option>
				   @}
				   @}
				 </select>
				</div>
			</div>
			<div class="row cl">
				<label class="form-label col-xs-4 col-sm-3"><span
					class="c-red">*</span>
				允许投稿：</label>
				<div class="formControls col-xs-8 col-sm-9">
				   @if(isNotEmpty(category.allowFrontPost)&&category.allowFrontPost){
				   <input  class="input-radio"  type="radio" name="category.allow_front_post" value="true" checked="checked"> 是 </input>
				   <input  class="input-radio" type="radio" name="category.allow_front_post" value="false"> 否 </input>
				   @}else{
                   <input class="input-radio"  type="radio" name="category.allow_front_post" value="true"> 是 </input>
				   <input class="input-radio" type="radio" name="category.allow_front_post" value="false" checked="checked"> 否 </input>		   
				   @}
				</div>
			</div>
			<div class="row cl">
				<label class="form-label col-xs-4 col-sm-3">
				<span
					class="c-red">*</span>
				是否单页：</label>
				<div class="formControls col-xs-8 col-sm-9">
				   @if(isNotEmpty(category.alone)&&category.alone){
				   <input id="isAlone" class="input-radio"  type="radio" name="category.alone" value="true" checked="checked"> 是 </input>
				   <input id="notAlone"  class="input-radio" type="radio" name="category.alone" value="false"> 否 </input>
				   @}else{
                   <input id="isAlone" class="input-radio"  type="radio" name="category.alone" value="true"> 是 </input>
				   <input id="notAlone"  class="input-radio" type="radio" name="category.alone" value="false" checked="checked"> 否 </input>		   
				   @}
				</div>
			</div>
			@if(isNotEmpty(category.alone)&&category.alone){
			<div id="content" class="row cl">
			@}else{
			<div id="content" class="row cl hidden">
			@}
			<label class="form-label col-xs-4 col-sm-3">单页内容：</label>
				<div class="formControls col-xs-8 col-sm-9">
				<textarea type="text" class="textarea" name="category.content" placeholder="默认内容">${category.content!}</textarea></div>
			</div>
			<div class="row cl">
				<label class="form-label col-xs-4 col-sm-3">频道模板：</label>
				<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" name="category.index_tpl"
						value="${category.indexTpl!'default/index.html'}" placeholder="首页模型，默认：default/index.html">
				</div>
			</div>
			<div class="row cl">
				<label class="form-label col-xs-4 col-sm-3">列表模板：</label>
				<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" name="category.list_tpl"
						value="${category.listTpl!'default/list.html'}" placeholder="列表模板，默认：default/list.html">
				</div>
			</div>
				<div class="row cl">
				<label class="form-label col-xs-4 col-sm-3">内容模板：</label>
				<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" name="category.content_tpl"
						value="${category.contentTpl!'default/content.html'}" placeholder="内容模板，默认：default/content.html">
				</div>
			</div>
			<div class="row cl">
				<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
				@if(isNotEmpty(category)){
					<input class="btn btn-primary radius" type="submit"
						value="&nbsp;&nbsp;修改&nbsp;&nbsp;">
						<a href="${ctxPath}/system/category/del/${category.categoryId}" class="btn btn-danger  radius">&nbsp;&nbsp;删除&nbsp;&nbsp;</a>
			  @}else{
			  	<input class="btn btn-primary radius" type="submit"
						value="&nbsp;&nbsp;添加分类&nbsp;&nbsp;">
			  @}
				</div>
			</div>
		</form>
	</article>
	<script type="text/javascript"
		src="${ctxPath}/r/lib/jquery/1.9.1/jquery.min.js"></script>
	<script type="text/javascript"
		src="${ctxPath}/r/lib/layer/2.1/layer.js"></script>
	<script type="text/javascript"
		src="${ctxPath}/r/lib/icheck/jquery.icheck.min.js"></script>
	<script type="text/javascript"
		src="${ctxPath}/r/lib/jquery.validation/1.14.0/jquery.validate.min.js"></script>
	<script type="text/javascript"
		src="${ctxPath}/r/lib/jquery.validation/1.14.0/validate-methods.js"></script>
	<script type="text/javascript"
		src="${ctxPath}/r/lib/jquery.validation/1.14.0/messages_zh.min.js"></script>
	<script type="text/javascript"
		src="${ctxPath}/r/system/h-ui/js/H-ui.js"></script>
	<script type="text/javascript"
		src="${ctxPath}/r/system/h-ui/js/H-ui.admin.js"></script>
	<!--请在下方写此页面业务相关的脚本-->
	<script type="text/javascript">
	
	
	
		$(function() {
			
			$("#isAlone").change(function(){
				$("#content").removeClass("hidden");

			});
			$("#notAlone").change(function(){
				$("#content").addClass("hidden");

			});
			$('.skin-minimal input').iCheck({
				checkboxClass : 'icheckbox-blue',
				radioClass : 'iradio-blue',
				increaseArea : '20%'
			});
			
			$("#form-modelfiled-add").validate({
				rules : {
					"category.category_name" : {
						required : true,
						@if(isEmpty(category)){
						remote : "${ctxPath}/system/category/valiname"
						@}
					},
					"category.shortname" : {
						required : true,
						@if(isEmpty(category)){
						remote : "${ctxPath}/system/category/valishortname"
						@}
					},
					"category.model_id" : {
						required : true
					}
					
				},
				onkeyup : false,
				focusCleanup : true,
				success : "valid",
				submitHandler : function(form) {
					$(form).ajaxSubmit();
					var index = parent.layer.getFrameIndex(window.name);
					parent.$('.btn-refresh').click();
					parent.layer.close(index);
				}
			});
		});
		
	</script>
</body>

</html>